//
//  Status.swift
//  weibo
//
//  Created by Fosen on 15/12/3.
//  Copyright © 2015年 fosen. All rights reserved.
//

import UIKit

class Status: NSObject {

    //微博创建时间
    var created_at: String?
    //	微博ID
    var id: Int = 0
    //微博信息内容
    var text: String?
    //微博来源
    var source: String?
    
    //定义user属性
    var user: User?
    
    //配图视图数组
    var pic_urls: [[String : String]]?

    init(dict: [String : AnyObject]) {
        super.init()
        setValuesForKeysWithDictionary(dict)
        
    }
    
    override func setValue(value: AnyObject?, forKey key: String) {
        
        //判断user键对应的value
        if key == "user"{
            if let dict = value as? [String : AnyObject] {
            
                user = User(dict: dict)
            }
            
            return
        }
        
        super.setValue(value, forKey: key)
    }
    
    
    //过滤
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {   }
    
    
    //重写discribe 属性
    override var description :String{
        let key = ["created_at","id","text","source"]
        return dictionaryWithValuesForKeys(key).description
        
    }
}
